package de.ret_world.openrpgstudio.editor.plugininterfaces;

import buoy.widget.BButton;
import buoy.widget.BFrame;
import buoy.widget.BMenuItem;
import buoy.widget.Shortcut;
import de.ret_world.openrpgstudio.editor.Configuration;
import org.java.plugin.Plugin;
import org.java.plugin.PluginManager;
import org.java.plugin.registry.PluginDescriptor;

/**
 * Default Interface for Tool Plugins. Defines methods to call several aspects of plugins.
 *
 * @author Emu
 */
public abstract class ToolPlugin extends Plugin {

    public static Configuration config;
    public static PluginManager manager;
    public static PluginDescriptor descriptor;

    /**
     * Initializes the plugin.
     */
    public abstract void init(BMenuItem menu, BButton button, BFrame parent);

    /**
     * @return the keyboard shortcut for this tool. Return null to disable this shortcut.
     */
    public abstract Shortcut getShortcut();

    @Override
    protected void doStart() throws Exception {
        config = Configuration.getInstance(getDescriptor().getId());
        descriptor = getDescriptor();
        manager = getManager();
    }

    @Override
    protected void doStop() throws Exception {
    }
}
